home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.alaska-software.com
/
2014.06.ftp.alaska-software.com.tar
/
ftp.alaska-software.com
/
3pp
/
mxsetup.old
/
{app}
/
MxDlgs.prg
< prev
next >
Wrap
Text File
|
2001-09-28
|
39KB
|
1,304 lines
//////////////////////////////////////////////////////////////////////
//
// MxDlgs.PRG
//
// Copyright:
// Maniacc Software Inc., (c) 2001. All rights reserved.
//
// Contents:
// Miscellaneous Dialogs
//
//////////////////////////////////////////////////////////////////////
#include "Gra.ch"
#include "Xbp.ch"
#include "Mx.ch"
#include "Common.ch"
#include "Dll.ch"
#include "Appevent.ch"
#pragma Library( "BAP.LIB" )
DLLFUNCTION GetSysColor ( nIndex ) USING STDCALL FROM USER32.DLL
DLLFUNCTION ChooseColorA( xColor ) USING STDCALL FROM COMDLG32.DLL
*******************************************************************
* MxMsgBox() - Almost identical to MsgBox(), but better
*******************************************************************
PROCEDURE MxMsgBox( cMessage, cTitle, cJustify, cFont, nColorFG, nColorBG)
LOCAL oDlg, oDa, oIcon, oXbp, nEvent, mp1, mp2, nJustify
LOCAL oFocus := setAppFocus()
LOCAL aPos := setAppWindow():currentPos(),aSize := {200,100}
DEFAULT cTitle to ""
DEFAULT cJustify to "L"
if upper(cJustify)=="C"
nJustify := XBPSTATIC_TEXT_CENTER
elseif upper(cJustify)=="R"
nJustify := XBPSTATIC_TEXT_RIGHT
else
nJustify := XBPSTATIC_TEXT_LEFT
endif
cFont := iif(!empty(cFont),cFont,MxGetFont("MessageFont"))
if val(cFont)==0
cFont := alltrim(str(val(MxGetFont("MessageFont"))))+"."+cFont
endif
oDlg := MxDialog(,,aPos, aSize,{{XBP_PP_COMPOUNDNAME,cFont}},.F.,cTitle,.T.,.F.,.F.,XBPDLG_RAISEDBORDERTHICK_FIXED )
oDlg:setFont():codePage := 204
oDlg:configure()
oDa := oDlg:drawingArea
if nColorFG<>Nil
oDa:setColorFG(nColorFG)
endif
if nColorBG<>Nil
oDa:setColorBG(nColorBG)
endif
oIcon := MxSysIcon(oDa,XBPSTATIC_SYSICON_ICONWARNING,{15,50})
oXbp := MxStatic():new()
oXbp:caption := cMessage
oXbp:autoSize := .T.
oXbp:options := nJustify+iif(chr(13)$cMessage.or.chr(10)$cMessage,XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_WORDBREAK,0)
oXbp:create( oDa,,{60,50},{0,0} )
aSize[1] := oXbp:currentSize()[1]+90
aSize[2] := oXbp:currentSize()[2]+(val(cFont)*1.5)+12+56
aSize[2] := iif(aSize[2]<100,100,aSize[2])
aSize[2] := iif(oDlg:titlebar.and.aSize[2]<120,120,aSize[2])
oDlg:setSize(aSize)
oDlg:setPos( {aPos[1]+((setAppWindow():currentSize()[1]-aSize[1])/2),aPos[2]+((setAppWindow():currentSize()[2]-aSize[2])/2)} )
aSize := oDa:currentSize()
oIcon:setPos({15,aSize[2]-48})
oXbp:setPos({60,iif(aSize[2]<120,aSize[2]-oXbp:currentSize()[2]-25,aSize[2]-oXbp:currentSize()[2]-15)})
oXbp := MxPushButton():new()
oXbp:caption := " OK "
oXbp:create( oDa,,{(aSize[1]-80)/2,10},{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg) }
oDlg:show()
setAppFocus(oXbp)
nEvent := xbe_None
do while nEvent<>xbeP_Close
nEvent := AppEvent( @mp1,@mp2,@oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
enddo
nEvent := xbeP_None
RETURN
*******************************************************************
* MxConfirmBox() - Almost identical to ConFirmBox(), but better
*******************************************************************
FUNCTION MxConFirmBox( oOwner, cMessage, cTitle, nButtons, nStyle, nStartButton, cJustify, cFont, nColorFG, nColorBG )
LOCAL oDlg, oDa, oIcon, oXbp, mp1, mp2, nEvent
LOCAL oFocus := setAppFocus()
LOCAL nMinWidth, nMinHeight := 120
LOCAL aPos := setAppWindow():currentPos(),aSize := {200,100}
LOCAL lOK := lCancel := lYes := lRetry := lAbort := lIgnore := lEnter := lNo := .F.
LOCAL nReturn, nQtyButtons, nOffset := 47
DEFAULT cTitle to ""
DEFAULT nButtons to XBPMB_OKCANCEL
DEFAULT nStyle to XBPMB_NOICON
DEFAULT nStartButton to XBPMB_DEFBUTTON1
DEFAULT cJustify to "L"
if upper(cJustify)=="C"
nJustify := XBPSTATIC_TEXT_CENTER
elseif upper(cJustify)=="R"
nJustify := XBPSTATIC_TEXT_RIGHT
else
nJustify := XBPSTATIC_TEXT_LEFT
endif
cFont := iif(!empty(cFont),cFont,MxGetFont("MessageFont"))
if val(cFont)==0
cFont := alltrim(str(val(MxGetFont("MessageFont"))))+"."+cFont
endif
if nButtons==XBPMB_OK
lOK := .T.
nMinWidth := 120
nQtyButtons := 1
elseif nButtons==XBPMB_OKCANCEL
lOK := .T.
lCancel := .T.
nMinWidth := 205
nQtyButtons := 2
elseif nButtons==XBPMB_RETRYCANCEL
lRetry := .T.
lCancel := .T.
nMinWidth := 205
nQtyButtons := 2
elseif nButtons==XBPMB_ABORTRETRYIGNORE
lAbort := .T.
lRetry := .T.
lIgnore := .T.
nMinWidth := 290
nQtyButtons := 3
elseif nButtons==XBPMB_YESNO
lYes := .T.
lNo := .T.
nMinWidth := 205
nQtyButtons := 2
elseif nButtons==XBPMB_YESNOCANCEL
lYes := .T.
lNo := .T.
lCancel := .T.
nMinWidth := 290
nQtyButtons := 3
elseif nButtons==XBPMB_CANCEL
lCancel := .T.
nMinWidth := 120
nQtyButtons := 1
elseif nButtons==XBPMB_ENTER
lEnter := .T.
nMinWidth := 120
nQtyButtons := 1
elseif nButtons==XBPMB_ENTERCANCEL
lEnter := .T.
lCancel := .T.
nMinWidth := 205
nQtyButtons := 2
endif
oDlg := MxDialog(,,aPos, aSize,{{XBP_PP_COMPOUNDNAME,cFont}},.F.,cTitle,.T.,.F.,.F.,XBPDLG_RAISEDBORDERTHICK_FIXED )
oDa := oDlg:drawingArea
if nColorFG<>Nil
oDlg:drawingArea:setColorFG(nColorFG)
endif
if nColorBG<>Nil
oDlg:drawingArea:setColorBG(nColorBG)
endif
if nStyle>=XBPMB_MOVEABLE
nStyle := nStyle-XBPMB_MOVEABLE
elseif nStyle>=XBPMB_SYSMODAL
nStyle := nStyle-XBPMB_SYSMODAL
endif
if nStyle==XBPMB_NOICON
nOffset := 0
nMinHeight := 100
elseif nStyle==XBPMB_QUESTION
nStyle := XBPSTATIC_SYSICON_ICONQUESTION
oIcon := MxSysIcon(oDa,nStyle,{15,50})
elseif nStyle==XBPMB_WARNING
nStyle := XBPSTATIC_SYSICON_ICONWARNING
oIcon := MxSysIcon(oDa,nStyle,{15,50})
elseif nStyle==XBPMB_INFORMATION
nStyle := XBPSTATIC_SYSICON_ICONINFORMATION
oIcon := MxSysIcon(oDa,nStyle,{15,50})
elseif nStyle==XBPMB_CRITICAL
nStyle := XBPSTATIC_SYSICON_ICONERROR
oIcon := MxSysIcon(oDa,nStyle,{15,50})
endif
oXbp := MxStatic():new()
oXbp:caption := cMessage
oXbp:autoSize := .T.
oXbp:options := nJustify+iif(chr(13)$cMessage.or.chr(10)$cMessage,XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_WORDBREAK,0)
oXbp:create( oDa,,{60,50},{0,0} )
aSize[1] := oXbp:currentSize()[1]+90
if aSize[1]<nMinWidth
aSize[1] := nMinWidth
endif
aSize[2] := oXbp:currentSize()[2]+(val(cFont)*1.5)+12+56
aSize[2] := iif(aSize[2]<nMinHeight,nMinHeight,aSize[2])
oDlg:setSize(aSize)
oDlg:setPos( {aPos[1]+((setAppWindow():currentSize()[1]-aSize[1])/2),aPos[2]+((setAppWindow():currentSize()[2]-aSize[2])/2)} )
aSize := oDa:currentSize()
if !empty(oIcon)
oIcon:setPos({15,aSize[2]-48})
endif
oXbp:setPos({60,iif(aSize[2]<120,aSize[2]-oXbp:currentSize()[2]-25,aSize[2]-oXbp:currentSize()[2]-15)})
if nQtyButtons==1
aPos := { (aSize[1]-80)/2,10 }
elseif nQtyButtons==2
aPos := { (aSize[1]-165)/2,10 }
else
aPos := { (aSize[1]-250)/2,10 }
endif
if lOK
oXbp := MxPushButton():new()
oXbp:caption := CAP_OK
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_OK }
aPos[1] := aPos[1]+85
endif
if lAbort
oXbp := MxPushButton():new()
oXbp:caption := CAP_ABORT
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_ABORT }
aPos[1] := aPos[1]+85
endif
if lYes
oXbp := MxPushButton():new()
oXbp:caption := CAP_YES
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_YES }
aPos[1] := aPos[1]+85
endif
if lRetry
oXbp := MxPushButton():new()
oXbp:caption := CAP_RETRY
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_RETRY }
aPos[1] := aPos[1]+85
endif
if lNo
oXbp := MxPushButton():new()
oXbp:caption := CAP_NO
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_NO }
aPos[1] := aPos[1]+85
endif
if lIgnore
oXbp := MxPushButton():new()
oXbp:caption := CAP_IGNORE
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_IGNORE }
aPos[1] := aPos[1]+85
endif
if lCancel
oXbp := MxPushButton():new()
oXbp:caption := CAP_CANCEL
oXbp:create( oDa,,aPos,{80,(val(cFont)*1.5)+12} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg), nReturn := XBPMB_RET_CANCEL }
aPos[1] := aPos[1]+85
endif
oDlg:show()
if nQtyButtons==1
setAppFocus(oXbp)
elseif nQtyButtons==2
if nStartButton==XBPMB_DEFBUTTON1
setAppFocus(oDa:childList()[len(oDa:ChildList())-1])
else
setAppFocus(oDa:childList()[len(oDa:ChildList())])
endif
elseif nQtyButtons==3
if nStartButton==XBPMB_DEFBUTTON1
setAppFocus(oDa:childList()[len(oDa:ChildList())-2])
elseif nStartButton==XBPMB_DEFBUTTON2
setAppFocus(oDa:childList()[len(oDa:ChildList())-1])
else
setAppFocus(oDa:childList()[len(oDa:ChildList())])
endif
endif
nEvent := xbe_None
do while nEvent<>xbeP_Close
nEvent := AppEvent( @mp1,@mp2,@oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
enddo
nEvent := xbeP_None
RETURN nReturn
*******************************************************************
* MxGraph() - Display a Graph of Data contained in an Array
*******************************************************************
FUNCTION MxGraph( oDa, aPos, aSize, cTitle, cUnits, aValues, aCaptions, aSubCaptions, aColors )
LOCAL oStatic, oXbp, oGraph, oBar, oTxt
LOCAL nHeight, nWidth, nY_Factor, nX, nY , nMaxValue:= 1, nSpace := 5, nStep
LOCAL nPeriods:=len(aValues)
LOCAL nItems:=len(aValues[1])
LOCAL i,j
LOCAL aGraphSize := {aSize[1]-70,aSize[2]-80}
LOCAL aGraphPos := {60,70}
LOCAL nIncrements
DEFAULT aCaptions to {""}
DEFAULT aSubCaptions to {""}
DEFAULT aColors to {GRA_CLR_PALEGRAY,GRA_CLR_DARKGRAY,GRA_CLR_BLACK}
for i := 1 to nPeriods
for j := 1 to nItems
nMaxValue := iif(nMaxValue<aValues[i,j],aValues[i,j],nMaxValue)
next j
next i
oXbp := MxStatic():new()
oXbp:autoSize := .T.
oXbp:caption := alltrim(str(nMaxValue))
oXbp:create( oDa,,{0,0},{0,0},,.F.)
j := oXbp:currentSize()[1]+16
aGraphSize[1] := aSize[1]-j-34
aGraphPos[1] := j+24
aGraphSize[2] := iif(!empty(aCaptions[1]),aGraphSize[2],aGraphSize[2]+15)
aGraphSize[2] := iif(!empty(aSubCaptions[1]),aGraphSize[2],aGraphSize[2]+15)
aGraphSize[2] := iif(!empty(cTitle),aGraphSize[2],aGraphSize[2]+20)
aGraphPos[2] := aSize[2]-(aGraphSize[2]+10)
nY_Factor := (aGraphSize[2]-10)/nMaxValue
nStep := aGraphSize[2]/25 // 25 pixel vertical spacing
nStep := round((nMaxValue/nStep/25),0)*25 // round to nearest 25 units
nWidth := int( (aGraphSize[1]-((nPeriods-1)*nSpace)-20)/(nPeriods*nItems))
oStatic := MxStatic():new()
oStatic:type := XBPSTATIC_TYPE_RAISEDRECT
oStatic:create(oDa,, aPos, aSize,,.F.)
oGraph := MxStatic():new()
oGraph:type := XBPSTATIC_TYPE_RECESSEDRECT
oGraph:options := XBPSTATIC_FRAMETHICK
oGraph:create(oStatic:drawingArea,,aGraphPos,aGraphSize, {{XBP_PP_BGCLR,GRA_CLR_WHITE}})
nIncrements := (aGraphSize[2]-20)/nMaxValue
for i := 0 to nMaxValue step nStep
oTxt := XbpStatic():new()
oTxt:options := XBPSTATIC_TEXT_RIGHT
oTxt:caption := alltrim(str(i))
oTxt:create( oStatic:drawingArea, , {22,aGraphPos[2]-5+((i-1)*nIncrements)}, {j,12}, {{XBP_PP_COMPOUNDNAME,"8.Arial"}} )
next i
oTxt := MxStatic():new()
oTxt:caption := cUnits
oTxt:angle := 90
oTxt:create( oStatic:drawingArea, , {22,aGraphPos[2]}, {12,aGraphSize[2]}, {{XBP_PP_COMPOUNDNAME,"12.Arial Bold"}} )
if ((i-1)*nIncrements)<aGraphSize[2]
oTxt := XbpStatic():new()
oTxt:options := XBPSTATIC_TEXT_RIGHT
oTxt:caption := alltrim(str(i))
oTxt:create( oStatic:drawingArea, , {22,aGraphPos[2]-5+((i-1)*nIncrements)}, {j,12}, {{XBP_PP_COMPOUNDNAME,"8.Arial"}} )
endif
nX := 10
if !empty(cTitle)
oTxt := MxStatic():new()
oTxt:caption := cTitle
oTxt:options := XBPSTATIC_TEXT_CENTER
oTxt:create(oStatic:drawingArea,,{0,5},{oStatic:drawingArea:currentSize()[1],20}, {{XBP_PP_COMPOUNDNAME,"12.Arial Bold"}} )
endif
if empty(cTitle) .or. (empty(aCaptions[1]).and.empty(aSubCaptions[1]))
else
oBar := MxStatic():new()
oBar:type := XBPSTATIC_TYPE_RAISEDBOX
oBar:create(oStatic:drawingArea,,{oStatic:drawingArea:currentSize()[1]/3,30},{oStatic:drawingArea:currentSize()[1]/3,4} )
endif
for i := 1 to nPeriods
if !empty(aCaptions[1])
oTxt := MxStatic():new()
oTxt:caption := aCaptions[i]
oTxt:options := XBPSTATIC_TEXT_CENTER
oTxt:create(oStatic:drawingArea,,{aGraphPos[1]+nX,aGraphPos[2]-30},{nWidth*nItems,15}, {{XBP_PP_COMPOUNDNAME,"8.Arial Bold"}} )
endif
for j := 1 to nItems
if !empty(aSubCaptions[1])
oTxt := MxStatic():new()
oTxt:caption := aSubCaptions[j]
oTxt:options := XBPSTATIC_TEXT_CENTER
oTxt:create(oStatic:drawingArea,,{aGraphPos[1]+nX+(nWidth*(j-1)),aGraphPos[2]-15},{nWidth,15}, {{XBP_PP_COMPOUNDNAME,"8.Arial"}} )
endif
oBar := XbpStatic():new()
oBar:create( oGraph:drawingArea,;
oGraph:drawingArea,;
{nX+((j-1)*nWidth),0},;
{nWidth-1,(int(nY_Factor*aValues[i,j]))-0},;
{{XBP_PP_BGCLR,aColors[j]}} )
next j
nX := nX + (nItems*nWidth)+nSpace
next i
oStatic:show()
RETURN oStatic
*******************************************************************
*******************************************************************
* MxColorDialog() - Select a Color
*******************************************************************
*******************************************************************
FUNCTION MxColorDialog( nColor, oDlg, nFullOpen, nCustom )
#define CC_RGBINIT 0x1
#define CC_FULLOPEN 0x2
#define CC_PREVENTFULLOPEN 0x4
#define CC_COLORSHOWHELP 0x8
#define CC_ENABLEHOOK 0x10
#define CC_ENABLETEMPLATE 0x20
#define CC_ENABLETEMPLATEHANDLE 0X40
// Win9x Only
#define CC_SOLIDCOLOR 0x80
#define CC_ANYCOLOR 0x100
// End Win9x Only
LOCAL aStruct, cStruct, aXbColors
LOCAL n, nFlags,nR, nG, nB
STATIC aColors := Nil
STATIC cArray
default nColor to 0
default oDlg to setAppWindow():drawingArea
default nFullOpen to 0
default nCustom to 0
if nCustom>2
aColors := Nil
endif
nCustom := iif(nCustom>9,nCustom-10,nCustom)
nCustom := iif(nCustom<0,0,nCustom)
aXbColors := {33554431,33488896,16777471,28883199,;
16828416,33554176,16842751,29409472,;
16777216,25165824,16777344,23619839,;
16809984,29409280,16810176,25198720}
nFlags:=CC_RGBINIT+iif("Windows 9"$os(),CC_SOLIDCOLOR,0)+iif(nFullOpen==-1,CC_PREVENTFULLOPEN,iif(nFullOpen==1,CC_FULLOPEN,0))
if valType(nColor)=="A"
nColor := (nColor[3]*256*256)+(nColor[2]*256)+nColor[1]
endif
if aColors==Nil
cArray := ""
aColors := Array(16)
for n:=1 to len(aColors)
if nCustom==0
aColors[n] := 16777215
elseif nCustom==1
if aScan(aColors,GetSysColor(n)-16777216)==0
aColors[n] := GetSysColor(n)-16777216
else
aColors[n] := 16777215
endif
aSort(aColors)
elseif nCustom==2
aColors[n] := aXbColors[n]-16777216
endif
next n
for n:=1 to len(aColors)
cArray := cArray+L2Bin(aColors[n])
next n
endif
aStruct := BaInit(9)
BaStruct(aStruct,36)
BaStruct(aStruct,iif(oDlg==Nil,0,oDlg:getHWND()))
BaStruct(aStruct,0)
BaStruct(aStruct,nColor)
BaStruct(aStruct,@cArray)
BaStruct(aStruct,nFlags)
BaStruct(aStruct,0)
BaStruct(aStruct,0)
BaStruct(aStruct,0)
cStruct := BaAccess( @aStruct )
if DllCall( "COMDLG32.DLL", DLL_STDCALL, "ChooseColorA", @cStruct ) == 1
BaExtract( aStruct, cStruct )
for n:=1 to 3
nColor := BaExtract( aStruct )
next n
cArray := BaExtract( aStruct )
endif
nB := int(nColor/(256*256))
nG := int((nColor-(nB*256*256))/256)
nR := nColor-(nB*256*256)-(nG*256)
// MxMsgBox("nColor="+alltrim(str(nColor))+chr(10)+"nB="+alltrim(str(nB))+chr(10)+"nG="+alltrim(str(nG))+chr(10)+"nR="+alltrim(str(nR)))
nColor := GraMakeRGBColor({nR,nG,nB})
RETURN nColor
*******************************************************************
*******************************************************************
* MxFontDialog() - Select a Font
*******************************************************************
*******************************************************************
FUNCTION MxFontDialog( oParent, oOwner, oScreenPS, oPrinterPS, aPos, cFont )
LOCAL oFont, oFontDlg, oScrnPS
DEFAULT oParent to setAppWindow()
DEFAULT oOwner to oParent
DEFAULT cFont to "Times New Roman"
if oParent:className()<>"XbpCRT"
oScrnPS := iif(empty(oScreenPS),XbpPresSpace():new():create(oParent:winDevice()),oScreenPS)
endif
oFontDlg := XbpFontDialog():new( oParent, oOwner, oScrnPS, oPrinterPS, aPos )
oFontDlg:familyName := cFont
oFontDlg:create()
oFont := oFontDlg:display()
oFontDlg:destroy()
oScrnPS:destroy()
RETURN oFont //alltrim(str(oFont:nominalPointSize))+"."+oFont:compoundName+iif(oFont:underScore," UnderScore","")
*******************************************************************
* MxModal() - Template for a Modal Dialog
*******************************************************************
PROCEDURE MxModal( cTitle )
LOCAL oDlg, oDa, oIcon, oXbp, mp1, mp2, nEvent
LOCAL oFocus := setAppFocus()
LOCAL aPos := setAppWindow():currentPos(),aSize := {200,100}
LOCAL lDone := .F.
DEFAULT cTitle to ""
oDlg := XbpDialog():new()
oDlg:taskList := .F.
oDlg:sysMenu := .F.
oDlg:title := cTitle
oDlg:keyboard := { |nKey,uNil,self|iif(nKey==xbeK_ESC,PostAppEvent(xbeP_Close,,,self),Nil)}
oDlg:close := {|| MxEnableSiblings(oDlg),oDlg:setModalState(XBP_DISP_MODELESS),oDlg:destroy(),setAppFocus(oFocus),nEvent:=xbe_None}
oDlg:create(AppDeskTop(),setAppWindow(), aPos, aSize,{{XBP_PP_COMPOUNDNAME,"9.Arial"}},.F. )
oDa := oDlg:drawingArea
// Add your code here for Xbase Parts, etc.
//
***** Show the Dialog and disable the Owner and all Siblings
oDlg:show()
oDlg:setModalState(XBP_DISP_APPMODAL)
MxDisableSiblings( oDlg )
***** Set the Focus to this Dialog and the desired Xbase Part
setAppFocus(oDlg)
setAppFocus(oXbp)
nEvent := xbe_None
do while !lDone
nEvent := AppEvent( @mp1,@mp2,@oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
enddo
nEvent := xbeP_None
RETURN
*******************************************************************
* MxDialog() - create a Dialog (SDI Format)
*******************************************************************
FUNCTION MxDialog( oParent, oOwner, aPos, aSize, aPresParam, lVisible, cTitle, lModal, TaskList, Sysmenu, Border, Bitmap )
LOCAL oDlg, oDa, oIcon, oXbp, mp1, mp2, nEvent
LOCAL oFocus := setAppFocus()
DEFAULT oParent to AppDeskTop()
DEFAULT oOwner to oParent
DEFAULT aPos to setAppWindow():currentPos()
DEFAULT aSize to setAppWindow():currentSize()
DEFAULT aPresParam to Nil
DEFAULT lVisible to .T.
DEFAULT cTitle to ""
DEFAULT lModal to .T.
DEFAULT TaskList to .F.
DEFAULT SysMenu to .T.
DEFAULT Border to XBPDLG_RECESSEDBORDERTHIN_FIXED
if lModal
oParent := AppDeskTop()
oOwner := setAppWindow()
endif
oDlg := XbpDialog():new()
oDlg:taskList := taskList
oDlg:sysMenu := sysMenu
oDlg:title := cTitle
oDlg:titlebar := iif(!tasklist.and.!sysmenu.and.empty(cTitle),.F.,.T.)
oDlg:border := iif(!empty(Border),Border,Nil)
oDlg:keyboard := { |nKey,uNil,self|iif(nKey==xbeK_ESC,PostAppEvent(xbeP_Close,,,self),Nil)}
oDlg:close := {|| MxEnableSiblings(oDlg),oDlg:setModalState(XBP_DISP_MODELESS),oDlg:destroy(),setAppFocus(oFocus),nEvent:=xbe_None}
oDlg:create(oParent, oOwner, aPos, aSize, aPresParam, lVisible )
if lModal
oDlg:setModalState(XBP_DISP_APPMODAL)
MxDisableSiblings( oDlg )
endif
setAppFocus( oDlg )
RETURN oDlg
*******************************************************************
* PROCEDURE MxDisableSiblings()
*******************************************************************
PROCEDURE MxDisableSiblings( oXbp )
LOCAL i, Parent := oXbp:setParent()
if Parent <> AppDesktop()
for i := 1 to len(Parent:childList())
if Parent:childList()[i]<>oXbp
Parent:childList()[i]:disable()
endif
next i
endif
RETURN
*******************************************************************
* PROCEDURE MxEnableSiblings()
*******************************************************************
PROCEDURE MxEnableSiblings( oXbp )
LOCAL i, Parent := oXbp:setParent()
if Parent <> AppDesktop()
for i := 1 to len(Parent:childList())
if Parent:childList()[i]<>oXbp
Parent:childList()[i]:enable()
endif
next i
endif
RETURN
*******************************************************************
* PROCEDURE MxPrinterPS()
*******************************************************************
FUNCTION MxPrinterPS()
LOCAL oPS := Nil
LOCAL oDC := MxSetPrinter(.T.,,,.T.)
LOCAL oFocus := setAppFocus()
if oDC<>Nil
oPS:=XbpPresSpace():new()
oPS:Create( oDC, oDC:paperSize(), GRA_PU_LOMETRIC )
endif
setAppFocus(oFocus)
RETURN oPS
*******************************************************************
* PROCEDURE MxSetPrinter()
*******************************************************************
FUNCTION MxSetPrinter(lDisplay,nMode,nPrintRange,lPrintToFile,lMark,lCollate,nCopies,aRange)
LOCAL oDC := XbpPrinter():new(), oPrintDlg
LOCAL aArray[6]
DEFAULT lDisplay TO .F.
DEFAULT nMode TO XBPPDLG_MODE_DRIVER
DEFAULT nPrintRange TO XBPPDLG_PRINT_ALLPAGES
DEFAULT lPrintToFile TO .F.
DEFAULT lMark TO .F.
DEFAULT lCollate TO .F.
DEFAULT nCopies TO 1
DEFAULT aRange TO {0,0}
if empty(oDC:list())
MxMsgBox("There are no Printers available on this System")
RETURN NIL
else
oDC:create()
endif
if lDisplay
oPrintDlg := XbpPrintDialog():new():create()
if nMode<>XBPPDLG_MODE_APPLICATION
oPrintDlg:mode := XBPPDLG_MODE_DRIVER
else
oPrintDlg:mode := nMode
endif
oPrintDlg:printRange := nPrintRange
oPrintDlg:enableMark := lMark
oPrintDlg:enablePrintToFile := lPrintToFile
oPrintDlg:enableCollate := lCollate
oPrintDlg:enableNumCopies := .T.
oPrintDlg:pageRange := aRange
oDC := oPrintDlg:display(oDC)
if !empty(oDC)
oDC:cargo := {oPrintDlg:printRange,;
oPrintDlg:printToFile,;
oPrintDlg:collate,;
oPrintDlg:numCopies,;
oPrintDlg:pageRangeSelected}
endif
endif
RETURN oDC
*******************************************************************
* MxDebug() - Pops up a small red modal dialog in the upper-right
* corner of setAppWindow() that allows the value of
* Public iVar Mx_Debug to be set from 0-10. This value
* can them be used to display or suppress debug messages.
* ie:
* iif(Mx_Debug>3,MxMsgBox("Message","Title"),Nil)
*******************************************************************
PROCEDURE MxDebug()
LOCAL oDlg, oDa, oXbp, nEvent, mp1, mp2, oSpin
LOCAL aPos := setAppWindow():currentPos(),aSize := {150,70}
aPos[1] := aPos[1]+setAppWindow():currentSize()[1]-152
aPos[2] := aPos[2]+setAppWindow():currentSize()[2]-72
oDlg := MxDialog(,,aPos, aSize,,.F.,"",.T.,.F.,.F.,XBPDLG_RAISEDBORDERTHICK_FIXED )
oDa := oDlg:drawingArea
oDa:setcolorBG(GRA_CLR_RED)
oXbp := MxStatic():new()
oXbp:caption := "Debug Level:"
oXbp:autoSize := .T.
oXbp:create( oDa,,{10,37},{50,20},{{XBP_PP_FGCLR,GRA_CLR_WHITE},{XBP_PP_COMPOUNDNAME,"10.Arial Bold"}} )
oSpin := XbpSpinButton():new()
oSpin:create( oDa,,{100,37},{35,20},{{XBP_PP_COMPOUNDNAME,"10.Arial Bold"}} )
oSpin:setNumLimits( 0,10 )
oSpin:setData(Mx_Debug)
oXbp := MxPushButton():new()
oXbp:caption := "Done"
oXbp:create( oDa,,{10,5},{70,24},{{XBP_PP_BGCLR,GRA_CLR_PALEGRAY},{XBP_PP_COMPOUNDNAME,"10.Arial Bold"}} )
oXbp:activate := { || PostAppEvent(xbeP_Close,,,oDlg) }
oDlg:show()
setAppFocus(oXbp)
nEvent := xbe_None
do while nEvent<>xbeP_Close
nEvent := AppEvent( @mp1,@mp2,@oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
enddo
nEvent := xbeP_None
Mx_Debug := oSpin:getdata()
RETURN
*******************************************************************
* MxFontAscii() - Displays the Ascii Chart for any Font
*******************************************************************
PROCEDURE MxFontAscii( cFont, lStandAloneApp )
LOCAL oDlg, oDa, oBrowse, oXbp, oTxt, nEvent, mp1, mp2
LOCAL oFocus := setAppFocus(), oCol, nOldArea := select()
LOCAL aPos := setAppWindow():currentPos(),aSize := {260,515}
LOCAL aPresParams, cDbf, cFile, lExit := .F.
LOCAL Struct, AscStrng, i
DEFAULT cFont to "11.Courier New"
DEFAULT lStandAloneApp to .F.
aPos[1] := (AppDeskTop():currentSize()[1]-260)/2
aPos[2] := (AppDeskTop():currentSize()[2]-515)/2
select (0)
CREATE Struct
APPEND BLANK
REPLACE FIELD_NAME WITH "Asc" , ;
FIELD_TYPE WITH "c" , ;
FIELD_LEN WITH 3 , ;
FIELD_DEC WITH 0
APPEND BLANK
REPLACE FIELD_NAME WITH "Char" , ;
FIELD_TYPE WITH "C" , ;
FIELD_LEN WITH 1 , ;
FIELD_DEC WITH 0
CLOSE
for i := 0 to 9
cDbf := "Asciinf"+alltrim(str(i))+".dbf"
cFile := curDrive()+":\"+cDbf+".dbf"
if !file(cFile)
exit
endif
next i
cDbf := left(cDbf,8)
CREATE &cFile FROM Struct NEW
close
USE &cFile Alias &cDbf EXCLUSIVE NEW
ERASE Struct.dbf
if lStandAloneApp
oDlg := setAppWindow()
else
oDlg := MxDialog(,,aPos, aSize,{{XBP_PP_COMPOUNDNAME,"10.Courier New"}},.F.,"Ascii Font Viewer",.T.,.F.,.T.,XBPDLG_RAISEDBORDERTHICK_FIXED )
oDlg:drawingArea:setColorBG(graMakeRGBcolor({130,150,180}))
endif
oDlg:close := { || lExit := .T. }
oDa := oDlg:drawingArea
for i := 1 to 255
append blank
replace Asc with padl(alltrim(str(i)),3)
replace Char with chr(i)
next i
oXbp := MxStatic():new()
oXbp:type := XBPSTATIC_TYPE_RAISEDBOX
oXbp:create( oDa,,{18,453},{224,26},{{XBP_PP_BGCLR,GRA_CLR_PALEGRAY}} )
oTxt := XbpStatic():new()
oTxt:tabstop := .F.
oTxt:caption := right(cFont,len(cFont)-at(".",cFont))
oTxt:create( oXbp:drawingArea,,{4,0},{216,20},{{XBP_PP_COMPOUNDNAME,"12.Arial Bold"}} )
oXbp := MxStatic():new()
oXbp:type := XBPSTATIC_TYPE_RAISEDBOX
oXbp:create( oDa,,{18,18},{122,425},{{XBP_PP_BGCLR,GRA_CLR_PALEGRAY}} )
oBrowse := XbpBrowse():new()
oBrowse:autoSize := .F.
oBrowse:sizeCols := .F.
oBrowse:cursorMode := XBPBRW_CURSOR_NONE
oBrowse:hscroll := .F.
oBrowse:create( oXbp:drawingArea,,{2,2},{115,418} )
oBrowse:stableBlock := {| | oBrowse:InvalidateRect() }
************** Navigation code blocks for the browser
oBrowse:skipBlock := {|n| DbSkipper(n)}
oBrowse:goTopBlock := {| | DbGoTop() }
oBrowse:goBottomBlock := {| | DbGoBottom() }
oBrowse:phyPosBlock := {| | Recno() }
if oBrowse:vScroll
******* Navigation code blocks for the vertical scroll bar
oBrowse:firstPosBlock := {| | 0 }
oBrowse:lastPosBlock := {| | 100 }
oBrowse:posBlock := {| | DbPosition() }
oBrowse:goPosBlock := {|n| DbGoPosition(n) }
endif
cField := FieldName( 1 )
aPresParams := {{XBP_PP_COL_HA_CAPTION,"Asc"},;
{XBP_PP_COL_DA_BGCLR,GRA_CLR_WHITE},;
{XBP_PP_COL_HA_ALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_LEFT},;
{XBP_PP_COL_DA_ROWHEIGHT,17},;
{XBP_PP_COL_DA_ROWWIDTH,50},;
{XBP_PP_COL_DA_CELLFRAMELAYOUT,XBPFRAME_NONE}}
oCol := XbpColumn():new(,,,,aPresParams)
oCol:dataLink := FieldBlock(cField)
oCol:create()
oBrowse:addColumn( oCol )
oCol:dataArea:setFontCompoundName("10.Courier New Bold")
cField := FieldName( 2 )
aPresParams := {{XBP_PP_COL_HA_CAPTION,"Char"},;
{XBP_PP_COL_DA_BGCLR,GRA_CLR_WHITE},;
{XBP_PP_COL_DA_FGCLR,GRA_CLR_DARKRED},;
{XBP_PP_COL_HA_ALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_ROWHEIGHT,17},;
{XBP_PP_COL_DA_ROWWIDTH,50},;
{XBP_PP_COL_DA_CELLFRAMELAYOUT,XBPFRAME_NONE}}
oCol := XbpColumn():new(,,,,aPresParams)
oCol:datalink := FieldBlock(cField)
oCol:create()
oCol := oBrowse:addColumn( oCol )
oCol:dataArea:setFontCompoundName(cFont+iif(!" Bold"$cFont," Bold",""))
oXbp := MxPushButton():new()
oXbp:caption := "Change"+chr(13)+"Font"
oXbp:tabstop := .T.
oXbp:create( oDa,,{150,18},{90,50},{{XBP_PP_COMPOUNDNAME,"12.Arial Bold"},;
{XBP_PP_BGCLR,GRA_CLR_BLUE},;
{XBP_PP_FGCLR,GRA_CLR_WHITE}} )
oXbp:activate := { |x| x:=setFont( oDa, , oBrowse, right(cFont,len(cFont)-at(".",cFont)) ),;
cFont:=iif(!empty(x),x,cFont),;
oTxt:setCaption(right(cFont,len(cFont)-at(".",cFont))) }
goto 32
oDa := oDlg:drawingArea
if lStandAloneApp
oXbp := MxStatic():new()
oXbp:caption := "CopyRight 2001"+;
chr(13)+;
"Maniacc Software"
oXbp:create( oDa,,{150,318},{90,125},{{XBP_PP_COMPOUNDNAME,"8.Arial"}} )
oXbp := AddPicture( oDa,{150,340},{90,0},"C:\Apptests\MxLib\Cabin3.bmp" )
endif
oDlg:show()
oBrowse:show()
nEvent := xbe_None
do while !lExit
nEvent := AppEvent( @mp1,@mp2,@oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
enddo
close
delete file &cFile
select (nOldArea)
if !lStandAloneApp
oDlg:destroy()
endif
setAppFocus( oFocus )
RETURN
*******************************************************************
* MxStringInfo() - Displays ASCII Values for a String
*******************************************************************
PROCEDURE MxStringInfo( cString, cFont, lStandAloneApp )
#define ARR_NO 2 // 'record pointer' for array
LOCAL oDlg, oDa, oSle, oBrowse, oXbp, nEvent, mp1, mp2
LOCAL oFocus := setAppFocus(), oCol, nOldArea := select()
LOCAL aPos := setAppWindow():currentPos(),aSize := {310,515}
LOCAL aPresParams, cDbf, lExit := .F.
LOCAL Struct, i
DEFAULT cString to "Enter a Text String Here"
DEFAULT cFont to "11.Courier New"
DEFAULT lStandAloneApp to .F.
aPos[1] := (AppDeskTop():currentSize()[1]-310)/2
aPos[2] := (AppDeskTop():currentSize()[2]-515)/2
select (0)
CREATE Struct
APPEND BLANK
REPLACE FIELD_NAME WITH "Pos" , ;
FIELD_TYPE WITH "c" , ;
FIELD_LEN WITH 4 , ;
FIELD_DEC WITH 0
APPEND BLANK
REPLACE FIELD_NAME WITH "Char" , ;
FIELD_TYPE WITH "C" , ;
FIELD_LEN WITH 1 , ;
FIELD_DEC WITH 0
APPEND BLANK
REPLACE FIELD_NAME WITH "Asc" , ;
FIELD_TYPE WITH "c" , ;
FIELD_LEN WITH 4 , ;
FIELD_DEC WITH 0
CLOSE
for i := 0 to 9
cDbf := "AscStrg"+alltrim(str(i))
cfile := curDrive()+":\"+cDbf+".dbf"
if !file(cFile)
exit
endif
next i
cDbf := left(cDbf,8)
CREATE &cFile FROM Struct NEW
close
USE &cFile Alias &cDbf EXCLUSIVE NEW
ERASE Struct.dbf
if lStandAloneApp
oDlg := setAppWindow()
else
oDlg := MxDialog(,,aPos, aSize,{{XBP_PP_COMPOUNDNAME,"10.Courier New"}},.F.,"String Information",.T.,.F.,.T.,XBPDLG_RAISEDBORDERTHICK_FIXED )
oDlg:drawingArea:setColorBG(graMakeRGBcolor({130,150,180}))
endif
oDlg:close := { || lExit := .T. }
oDa := oDlg:drawingArea
oSle := XbpSle():new()
oSle:bufferLength := 255
oSle:tabstop := .T.
oSle:create( oDa,,{20,455},{270,20} )
oSle:dataLink := { |x| iif(x==Nil,cString,cString:=x) }
oSle:setdata( cString )
cString := oSle:getdata()
for i := 1 to len(cString)
append blank
replace Pos with padl(alltrim(str(i)),4)
replace Char with cString[i]
replace Asc with padl(alltrim(str(asc(cString[i]))),4)
next i
oXbp := MxStatic():new()
oXbp:type := XBPSTATIC_TYPE_RAISEDBOX
oXbp:create( oDa,,{18,18},{172,425},{{XBP_PP_BGCLR,GRA_CLR_PALEGRAY}} )
oBrowse := XbpBrowse():new()
oBrowse:autoSize := .F.
oBrowse:sizeCols := .F.
oBrowse:cursorMode := XBPBRW_CURSOR_NONE
oBrowse:hscroll := .F.
oBrowse:create( oXbp:drawingArea,,{2,2},{165,418} )
oBrowse:stableBlock := {| | oBrowse:InvalidateRect() }
************** Navigation code blocks for the browser
oBrowse:skipBlock := {|n| DbSkipper(n)}
oBrowse:goTopBlock := {| | DbGoTop() }
oBrowse:goBottomBlock := {| | DbGoBottom() }
oBrowse:phyPosBlock := {| | Recno() }
if oBrowse:vScroll
******* Navigation code blocks for the vertical scroll bar
oBrowse:firstPosBlock := {| | 0 }
oBrowse:lastPosBlock := {| | iif(reccount()>17,reccount()*2,1) }
oBrowse:posBlock := {| | DbPosition() }
oBrowse:goPosBlock := {|n| DbGoPosition(n) }
endif
cField := FieldName( 1 )
aPresParams := {{XBP_PP_COL_HA_CAPTION,"Pos"},;
{XBP_PP_COL_DA_BGCLR,GRA_CLR_WHITE},;
{XBP_PP_COL_HA_ALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_LEFT},;
{XBP_PP_COL_DA_ROWHEIGHT,17},;
{XBP_PP_COL_DA_ROWWIDTH,50},;
{XBP_PP_COL_DA_CELLFRAMELAYOUT,XBPFRAME_NONE}}
oCol := XbpColumn():new(,,,,aPresParams)
oCol:dataLink := FieldBlock(cField)
oCol:create()
oBrowse:addColumn( oCol )
oCol:setFontCompoundName("10.Courier New")
cField := FieldName( 2 )
aPresParams := {{XBP_PP_COL_HA_CAPTION,"Char"},;
{XBP_PP_COL_DA_BGCLR,GRA_CLR_WHITE},;
{XBP_PP_COL_DA_FGCLR,GRA_CLR_DARKRED},;
{XBP_PP_COL_HA_ALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_ROWHEIGHT,17},;
{XBP_PP_COL_DA_ROWWIDTH,50},;
{XBP_PP_COL_DA_CELLFRAMELAYOUT,XBPFRAME_NONE}}
oCol := XbpColumn():new(,,,,aPresParams)
oCol:datalink := FieldBlock(cField)
oCol:create()
oCol := oBrowse:addColumn( oCol )
oCol:dataArea:setFontCompoundName(cFont+iif(!" Bold"$cFont," Bold",""))
cField := FieldName( 3 )
aPresParams := {{XBP_PP_COL_HA_CAPTION,"Asc"},;
{XBP_PP_COL_DA_BGCLR,GRA_CLR_WHITE},;
{XBP_PP_COL_HA_ALIGNMENT,XBPALIGN_HCENTER},;
{XBP_PP_COL_DA_CELLALIGNMENT,XBPALIGN_LEFT},;
{XBP_PP_COL_DA_ROWHEIGHT,17},;
{XBP_PP_COL_DA_ROWWIDTH,50},;
{XBP_PP_COL_DA_CELLFRAMELAYOUT,XBPFRAME_NONE}}
oCol := XbpColumn():new(,,,,aPresParams)
oCol:dataLink := FieldBlock(cField)
oCol:create()
oBrowse:addColumn( oCol )
oCol:dataArea:setFontCompoundName("11.Courier New Bold")
go top
oBrowse:goTopBlock
oDa := oDlg:drawingArea
if lStandAloneApp
oXbp := MxStatic():new()
oXbp:caption := "CopyRight 2001"+;
chr(13)+;
"Maniacc Software"
oXbp:create( oDa,,{200,398},{90,45},{{XBP_PP_COMPOUNDNAME,"8.Arial"}} )
oXbp := AddPicture( oDa,{200,340},{90,0},"C:\Apptests\MxLib\Cabin3.bmp" )
endif
oXbp := MxPushButton():new()
oXbp:caption := "Change"+chr(13)+"Font"
oXbp:tabstop := .T.
oXbp:create( oDa,,{200,18},{90,50},{{XBP_PP_COMPOUNDNAME,"12.Arial Bold"},;
{XBP_PP_BGCLR,GRA_CLR_BLUE},;
{XBP_PP_FGCLR,GRA_CLR_WHITE}} )
oXbp:activate := { |x| x:=setFont( oDa, oSle, oBrowse, right(cFont,len(cFont)-at(".",cFont)) ),cFont:=iif(!empty(x),x,cFont) }
setAppFocus(oDlg)
oDlg:show()
oBrowse:show()
setAppFocus(oSle)
oSle:setMarked( { 1,len(alltrim(oSle:editbuffer()))+1 } )
nEvent := xbe_None
do while !lExit
nEvent := AppEvent( @mp1,@mp2,@oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
if oSle:changed.or.len(cString)<>reccount()
setBrowse( oSle:editbuffer(), oBrowse )
if empty(oSle:editbuffer())
oSle:setdata("")
endif
endif
enddo
close
delete file &cFile
select (nOldArea)
if !lStandAloneApp
oDlg:destroy()
endif
setAppFocus( oFocus )
RETURN
STATIC FUNCTION setBrowse( cString, oBrowse )
LOCAL i, cCheckString := "", nRec := recno()
if reccount()>0
if empty(cString)
dbZap()
oBrowse:gotopBlock
oBrowse:refreshall()
else
go top
do while !eof()
cCheckString := cCheckString+Char
skip
enddo
goto nRec
if cCheckString==cString
RETURN Nil
else
DbZap()
endif
endif
elseif empty(cString)
RETURN Nil
endif
for i := 1 to len(cString)
append blank
replace Pos with padl(alltrim(str(i)),4)
replace Char with cString[i]
replace Asc with padl(alltrim(str(asc(cString[i]))),4)
next i
oBrowse:goTopBlock
goto iif(len(cString)<oBrowse:rowCount,1,len(cString)-oBrowse:rowCount+1)
oBrowse:refreshAll()
RETURN Nil
STATIC FUNCTION setFont( oDa, oSle, oBrowse, cFont )
LOCAL nDeltaY, i := 6
LOCAL aPoints
LOCAL cFontName
LOCAL oFont, oPS, oCol := oBrowse:getColumn(2)
oPS := oDa:lockPS()
oFont := XbpFont():new( oPS )
oFont:familyName := "Courier New Bold"
oFont:height := 0
oFont:width := 0
oFont:nominalPointSize := 10
oFont:create()
aPoints := GraQueryTextBox( oPS, "Test" )
nDeltaY := aPoints[1,2]-aPoints[2,2]
oFont:destroy()
oFont := MxFontDialog( oDa,,,, {20,20}, cFont )
if !empty(oFont)
cFontName := oFont:compoundName
oFont:destroy()
oFont := XbpFont():new( oPS )
oFont:familyName := cFontName
oFont:height := 0
oFont:width := 0
oFont:nominalPointSize := i
oFont:create()
GraSetFont( oPS, oFont )
do while (GraQueryTextBox(oPS,"Test")[1,2] - GraQueryTextBox(oPS,"Test")[2,2])<nDeltaY
oFont:destroy()
i := i+1
oFont := XbpFont():new( oPS )
oFont:familyName := cFontName
oFont:height := 0
oFont:width := 0
oFont:nominalPointSize := i
oFont:create()
GraSetFont( oPS, oFont )
enddo
cFont := alltrim(str(oFont:nominalPointSize))+"."+oFont:compoundName
oCol:dataArea:setFontCompoundName(cFont)
if !empty(oSle)
oSle:setFontCompoundName("10."+oFont:compoundName)
endif
oBrowse:refreshAll()
endif
oDa:unlockPS( oPS )
RETURN cFont